package chapter04.demo01;

/**
 * 1.继承
 * 2.重写
 */
class Hero {//英雄类
    int hp;//生命值
    int mp;//法力值
    int length;//攻击距离
    int move;//移动速度
    int speed;//攻速
    int cs;//暴击
    public  void  action(String downkey){
        if(downkey.equals("ctrl + 6"));{
            System.out.println("亮狗牌");
        }
    }
}
class Warrior extends Hero {//战士继承英雄属性

}
class Archer extends Hero {
    //重写
    public void action(String downkey){
        if(downkey.equals("Ctrl + 1"));{
            System.out.println("在别的游戏里我可是主角");
        }
        if(downkey.equals("Ctrl + 2"));{
            System.out.println("跳舞");
        }
    }
}
public class demo1 {
    public static void main(String[] args) {
        Warrior jiansheng = new Warrior();
        jiansheng.hp = 645;//给战士赋值初始生命值
        Archer ez = new Archer();
        ez.length = 525;
        ez.action("Ctrl + 1");
    }
}
